It is useful to be able to include program fragments as figures in a
text. The tgrind style option can be used to accomplish this
fairly painlessly by defining the \tagrind
command.
The \tagrind
command has the following proforma:
\tagrind* [loc]{file}{caption }{label }
|
As usual,
h
(here),
t
(top), b
(bottom) and p
(page) specifying where the listing may be placed.
\ref{
label}
command.
The listing file should be generated using tgrind and removing the first and last lines of the resulting file. For example, if the C source file file.c were to be used as a listing,
tgrind -f -lc file.c | sed -e 1d -e \$d >file.texwould generate a file file.tex suitable for use with
tagrind
. For example,
\tagrind{file}{This is an example}{eg}